#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int abs_compare(int a, int b) {
	int x =	0;
	if (abs(a) > abs(b))
		x = 1;
	else
		x = -1;
	return x;
}

int compare(int a, int b) {
	int x = 0;
	if (a > b)
		x = 1;
	else
		x = - 1;
	return x;
}

void sort(int *a, int n, int (*compare)(int, int )) {
	for (int j = 0; j < n; j++) {
		for (int i = 0; i < n - j - 1; i++) {
			if (compare(a[i], a[i + 1]) > 0) {
				int temp = a[i];
				a[i] = a[i + 1];
				a[i + 1] = temp;
			}
		}
	}

}

int main() {
	int A[] = {-2, 1, 3, - 4, -5, - 6};
	int size = sizeof(A) / sizeof(int);
	sort(A, size, abs_compare);
	for (int i = 0; i < size; i++)
		printf("%d ", A[i]);
	return 0;
}